package com.gt.entity.security;


import java.io.Serializable;

/**
 * 用户
 */
@SuppressWarnings("all")
public class User implements LoginDetail,TokenDetail,Serializable{

    private static final long serialVersionUID = -4327786808037809016L;

    private Long userId;                //用户id
    private String username;            //用户账号
    private String password;            //密码
    private Integer roleId;             //权限id
    private Long lastPasswordChange;    //最优修改时间
    private int enable;             //是否禁用1：启用  2：禁用
    private String authorities;         //用户权限

    public String getAuthorities() {
        return authorities;
    }

    public User setAuthorities(String authorities) {
        this.authorities = authorities;
        return this;
    }

    public User() {
    }

    public User(Long userId, String username, String password, Integer roleId, Long lastPasswordChange, int enable) {
        this.userId = userId;
        this.username = username;
        this.password = password;
        this.roleId = roleId;
        this.lastPasswordChange = lastPasswordChange;
        this.enable = enable;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    @Override
    public boolean enable() {
        if (this.enable == 1){
            return true;
        }
        return false;
    }


    public void setPassword(String password) {
        this.password = password;
    }

    public Integer getRoleId() {
        return roleId;
    }

    public void setRoleId(Integer roleId) {
        this.roleId = roleId;
    }

    public Long getLastPasswordChange() {
        return lastPasswordChange;
    }

    public void setLastPasswordChange(Long lastPasswordChange) {
        this.lastPasswordChange = lastPasswordChange;
    }

    public Integer getEnable() {
        return enable;
    }

    public void setEnable(Integer enable) {
        this.enable = enable;
    }

    @Override
    public String toString() {
        return "User{" +
                "userId=" + userId +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", roleId=" + roleId +
                ", lastPasswordChange=" + lastPasswordChange +
                ", enable=" + enable +
                '}';
    }
}
